﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Text;

namespace WorkFlowCore.Framework.Repositories4EF
{
    /// <summary>
    /// 用于给到 nuget包控制台命令使用    
    /// </summary>
    public class BloggingContextFactory : IDesignTimeDbContextFactory<WorkflowDbContext>
    {
        public WorkflowDbContext CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder<WorkflowDbContext>();
            //此处需要配置 SqlServer 的链接
            optionsBuilder.UseSqlServer("Data Source=HY-PTJD-XR002;Initial Catalog=WorkFlowCore1;User Id=sa;Password=12345678;connect Timeout=30;");
            return new WorkflowDbContext(optionsBuilder.Options);
        }
    }
}
